package com.example.ai.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author : zhayh
 * @date : 2021-4-28 20:07
 * @description :
 */

@Configuration
public class FileUploadConfig implements WebMvcConfigurer {
    @Value("${application.file.diskpath}")
    private String diskPath;
    @Value("${application.file.fileurl}")
    private String fileUrl;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler(fileUrl + "/**")  //
                .addResourceLocations("file:" + diskPath);
    }
}
